﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ERPStore
{
	public static class GlobalConfiguration
	{
		private static object m_Lock = new object();
		private static ERPStoreConfiguration m_Configuration;

		public static ERPStoreConfiguration Configuration
		{
			get
			{
				if (m_Configuration == null)
				{
					lock (m_Lock)
					{
						if (m_Configuration == null)
						{
							m_Configuration = new ERPStoreConfiguration();

							var container = new Microsoft.Practices.Unity.UnityContainer();

							m_Configuration.DependencyResolver = new IOC.UnityDependencyResolver(container);
							m_Configuration.Services = new DefaultServicesContainer(container);
							Start.ServicesConfig.Configure(container);
							Start.EventBrokerConfig.Register(container);
							Start.ServiceBusConfig.Configure(container);
							Start.WorkflowConfig.Configure(container);
						}
					}
				}
				return m_Configuration;
			}
		}

	}
}
